# -*- coding:utf-8 -*-
# __author__ : "张百科"
# Date: 2021/1/25 16:30
# File: craft.py
# IDE: PyCharm


from django_filters import rest_framework
from models.craft  import Craft
from utils.choices import craft_category_choices
import django_filters


class CraftFilter(rest_framework.FilterSet):
    craft_category = django_filters.ChoiceFilter(field_name='craft_category',choices=craft_category_choices)
    title = django_filters.CharFilter(field_name='title',lookup_expr='icontains')

    class Meta:
        model = Craft
        fields = ['craft_category', 'title']